package com.rc.saas.mini.service.hlht;

import com.rc.saas.mini.mapper.hlht.HlhtOperatorSettingMapper;
import com.rc.saas.mini.model.hlht.HlhtOperatorSetting;
import com.rc.saas.mini.model.hlht.HlhtOperatorSettingExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author wangzhengwei
 * @create 2021/12/18
 */
@Service
public class HlhtOperatorSettingServiceImpl implements HlhtOperatorSettingService {
    @Autowired
    private HlhtOperatorSettingMapper hlhtOperatorSettingMapper;

    @Override
    public HlhtOperatorSettingMapper getMapper() {
        return hlhtOperatorSettingMapper;
    }

    @Override
    public HlhtOperatorSetting selectByTenantCodeAndOperatorId(String tenantCode, String operatorId) {
        HlhtOperatorSettingExample example = new HlhtOperatorSettingExample();
        example.createCriteria().andTenantCodeEqualTo(tenantCode).andHlhtOperatorIdEqualTo(operatorId);
        List<HlhtOperatorSetting> list = hlhtOperatorSettingMapper.selectByExample(example);
        if (!CollectionUtils.isEmpty(list)) {
            return list.get(0);
        }
        return null;
    }
}
